package com.willian.andrappfw.utils;

import android.app.Application;
import android.content.pm.PackageInfo;
import android.content.pm.PackageManager;

public class ContextHolder {
    private static Application ApplicationContext;
    private static String versionName;
    private static int versionCode;

    public ContextHolder() { }

    public static void init(Application context) {
        ApplicationContext = context;

        try {
            PackageInfo packageInfo = context.getPackageManager().getPackageInfo(context.getPackageName(), 0);
            versionName = packageInfo.versionName;
            versionCode = packageInfo.versionCode;
        } catch (PackageManager.NameNotFoundException var2) {
        }

    }

    public static Application getContext() {
        return ApplicationContext;
    }

    public static String getVersionName() {
        return versionName;
    }

    public static int getVersionCode() {
        return versionCode;
    }
}
